<!DOCTYPE html>
<!-- ng-app -->
<html lang="en" ng-app>
<head>
    <meta charset="UTF-8">
    <title>Angular和js表达式之间的相互调用</title>
    <script src="../../../js/plugins/angular/angular.min.js" type="text/javascript"></script>
</head>
<body>
    <div ng-controller="c2_1">
        执行javascript表达式
        <input type="text" ng-model="expr1">
        <button ng-click="testExp1(expr1)">计算</button>
        <br/>

        执行Angular表达式
        <input type="text" ng-model="expr2">
        <span ng-bind="$eval(expr2)"></span>
    </div>
    <script>
        function c2_1($scope) {
            $scope.expr1 = 20;
            $scope.expr2 = '20+1|number:0';
            $scope.testExp1 = function (expr) {
                var newv = parseInt(expr) + 1;
                alert(newv);
            }
        }
    </script>
</body>
</html>